package com.fr.cell.editor;

import com.fr.cell.Grid;
import com.fr.cell.core.date.JDatePicker;
import com.fr.report.CellElement;
import java.awt.Component;
import java.util.Date;

public class DateCellEditor extends AbstractCellEditor
{
  private JDatePicker comboBox = new JDatePicker();

  public DateCellEditor()
  {
    this.comboBox.setFocusTraversalKeysEnabled(false);
  }

  public Object getCellEditorValue()
    throws Exception
  {
    return this.comboBox.getSelectedDate();
  }

  public Component getCellEditorComponent(Grid paramGrid, CellElement paramCellElement)
  {
    Object localObject = null;
    if (paramCellElement != null)
      localObject = paramCellElement.getValue();
    if ((localObject == null) || (!(localObject instanceof Date)))
      localObject = new Date();
    this.comboBox.setSelectedItem(localObject);
    return ((Component)this.comboBox);
  }
}